#ifndef TALENT_HH
#define TALENT_HH

#include <string>
#include <vector>
#include "AttributeBonuses.hh"

class Character; // Forward declaration to avoid circular inclusion

struct Talent {
    std::string name;
    std::string description;
    AttributeBonuses bonuses;

    Talent(const std::string& n, const std::string& desc, const AttributeBonuses& b)
        : name(n), description(desc), bonuses(b) {}

    void applyBonuses(Character& character, int layer) const;
};

class Talents {
public:
    static const std::vector<Talent>& getAllTalents() {  // Returns a static list of all available talents
        // Using static ensures that the list is initialized only once and reused throughout the program's lifecycle,
        // making it memory-efficient and globally accessible without needing to recreate it every time.
        static std::vector<Talent> allTalents = {  // Static local variable, initialized only once
            Talent("Vitality Surge", "Increases health", AttributeBonuses(100, 0, 0, 0, 0, 0, 0, 0)),
            Talent("Fury Strike", "Increases attack power", AttributeBonuses(0, 20, 0, 0, 0, 0, 0, 0)),
            Talent("Resilient Bastion", "Increases defense", AttributeBonuses(0, 0, 15, 0, 0, 0, 0, 0)),
            Talent("Swift Stride", "Increases speed", AttributeBonuses(0, 0, 0, 0, 0, 10, 0, 0)),
            Talent("Critical Blow", "Increases critical chance", AttributeBonuses(0, 0, 0, 10, 0, 0, 0, 0)),
            Talent("Devastating Impact", "Increases critical damage", AttributeBonuses(0, 0, 0, 0, 20, 0, 0, 0)),
            Talent("Iron Armor", "Increases armor", AttributeBonuses(0, 0, 0, 0, 0, 0, 10, 0)),
            Talent("Piercing Shot", "Increases penetration", AttributeBonuses(0, 0, 0, 0, 0, 0, 0, 10)),
            Talent("Life Surge", "Increases health and defense", AttributeBonuses(50, 0, 5, 0, 0, 0, 0, 0)),
            Talent("Combat Focus", "Increases attack power and critical chance", AttributeBonuses(0, 10, 0, 5, 0, 0, 0, 0))
        };
        return allTalents;  // Returns the static list of talents
    }

    static Talent createTalent(const std::string& name, const std::string& desc, const AttributeBonuses& bonuses) {  // Creates a new talent
        return Talent(name, desc, bonuses);  // Returns the newly created talent
    }

    Talents() = delete;  // Prevents the creation of Talents class instances
    Talents(const Talents&) = delete;  // Prevents copy construction
    Talents& operator=(const Talents&) = delete;  // Prevents copy assignment
    ~Talents() = default;  // Default destructor
};

#endif // TALENT_HH